<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>SUNCMS 后台管理系统</title>
	<script src="./include/javascript/sha1.js" type="text/javascript"></script>
	<script>
	var check_login = function()
	{
		var authcode = document.getElementById("authcode").value;
		if( authcode == '' )
		{
			alert( '验证码不能为空，请正确填写！' );
			return false;
		}
		else if( !authcode.match(/[a-zA-Z0-9_]{4}$/) )
		{
			alert( "验证码式不正确！\n验证码长度应该为4位字母和数字的组合，请正确填写！" );
			return false;
		}
		var username = document.getElementById("username").value;
		if( username == '' )
		{
			alert( "用户名不能为空，请正确填写！" );
			return false;
		}
		else if( !username.match(/^[a-zA-Z][a-zA-Z0-9_]{4,16}$/) )
		{
			alert( "用户名格式不正确！\n用户名只能由字母开头且由字母和数字组成，请正确填写！" );
			return false;
		}
		var password = document.getElementById("password").value;
		if( password == '' )
		{
			alert( '密码不能为空，请正确填写！' );
			return false;
		}
		else if( password.length < 4 || password.length > 16 )
		{
			alert( "密码格式不正确！\n密码长度应该在6-16位之间，请正确填写！" );
			return false;
		}
		else
		{
			var hash=hex_sha1( password );  
			document.getElementById( "password" ).value=hash;
			return true;
		}
	}
	</script>
	<link href="./images/system/login.css" rel="stylesheet" type="text/css">
	</head>
	<body scrolling="no" >
		<div class="main">
			<div id="main">
				<div id="login_box">
					<ul>
						<form method="post" action="<?php echo SCRIPT_NAME?>?m=platform&a=login&do=login" id='form'>
							<li>用户名：<input name="username" id='username' size="20" maxlength="20" type="text"></li>
							<li>密　码：<input name="password" id="password" size="20" type="password"></li>
							<li>
							验证码：<input id='authcode' name="authcode" size="9" value="" maxlength="32" type="text">
							<img height="20" align="absmiddle" onclick="this.src='./authcode.php?id='+Math.random()*5;" style="cursor: pointer;margin-top:1px;" alt="验证码,看不清楚?请点击刷新验证码" src="./authcode.php"/>
							</li>
							<li style="padding-left: 48px;">
							<input id='login' name="submit" value=" 登录 " class="btn" type="submit" onclick='return check_login();'> 
							<input name="reset" value=" 清除 " class="btn" type="reset">
							</li>
						</form>
					</ul>
				</div>
			</div>
		</div>
	</body>
</html>